﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SlimDX.RawInput;
using SlimDX.Multimedia;
using System.Windows.Forms;

namespace Vxl.Utils.Input
{
    public static class InputManager
    {
        private static bool[] buttons = new bool[3];

        public static void Initialize(Control control)
        {
            SlimDX.RawInput.Device.RegisterDevice(UsagePage.Generic, UsageId.Keyboard, DeviceFlags.None);
            SlimDX.RawInput.Device.RegisterDevice(UsagePage.Generic, UsageId.Mouse, DeviceFlags.None);

            input = new Input(control);

            SlimDX.RawInput.Device.KeyboardInput += Device_KeyboardInput;
            SlimDX.RawInput.Device.MouseInput += Device_MouseInput;

        }

        private static void Device_MouseInput(object sender, MouseInputEventArgs e)
        {
            input.Device_MouseInput(e);
        }

        private static void Device_KeyboardInput(object sender, KeyboardInputEventArgs e)
        {
            input.Device_KeyboardInput(e);
        }

        public static Input input
        {
            get;
            private set;
        }
    }
}
